package com.huifer.wgx.model;

import java.math.BigDecimal;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * <p>Title : ResultLineEntity </p>
 * <p>Description : </p>
 *
 * @author huifer
 * @date 2019-03-20
 */
@Entity
@Table(name = "t_result_line", schema = "at15", catalog = "")
public class ResultLineEntity {

    private Long resultLineId;
    private Long resultLineStartPointId;
    private String resultLineStartPointName;
    private BigDecimal resultLineStartPointDeep;
    private Long resultLineEndPointId;
    private String resultLineEndPointName;
    private BigDecimal resultLineEndPointDeep;
    private Long workId;
    private Long personnelId;
    private ResultPointEntity tResultPointByResultLineStartPointId;
    private ResultPointEntity tResultPointByResultLineEndPointId;
    private WorkEntity tWorkByWorkId;
    private PersonnelEntity tPersonnelByPersonnelId;
    private String resultLineType;

    @Basic
    @Column(name = "result_line_type")
    public String getResultLineType() {
        return resultLineType;
    }

    public void setResultLineType(String resultLineType) {
        this.resultLineType = resultLineType;
    }

    @Id
    @Column(name = "result_line_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getResultLineId() {
        return resultLineId;
    }

    public void setResultLineId(Long resultLineId) {
        this.resultLineId = resultLineId;
    }

    @Basic
    @Column(name = "result_line_start_point_id")
    public Long getResultLineStartPointId() {
        return resultLineStartPointId;
    }

    public void setResultLineStartPointId(Long resultLineStartPointId) {
        this.resultLineStartPointId = resultLineStartPointId;
    }

    @Basic
    @Column(name = "result_line_start_point_name")
    public String getResultLineStartPointName() {
        return resultLineStartPointName;
    }

    public void setResultLineStartPointName(String resultLineStartPointName) {
        this.resultLineStartPointName = resultLineStartPointName;
    }

    @Basic
    @Column(name = "result_line_start_point_deep")
    public BigDecimal getResultLineStartPointDeep() {
        return resultLineStartPointDeep;
    }

    public void setResultLineStartPointDeep(BigDecimal resultLineStartPointDeep) {
        this.resultLineStartPointDeep = resultLineStartPointDeep;
    }

    @Basic
    @Column(name = "result_line_end_point_id")
    public Long getResultLineEndPointId() {
        return resultLineEndPointId;
    }

    public void setResultLineEndPointId(Long resultLineEndPointId) {
        this.resultLineEndPointId = resultLineEndPointId;
    }

    @Basic
    @Column(name = "result_line_end_point_name")
    public String getResultLineEndPointName() {
        return resultLineEndPointName;
    }

    public void setResultLineEndPointName(String resultLineEndPointName) {
        this.resultLineEndPointName = resultLineEndPointName;
    }

    @Basic
    @Column(name = "result_line_end_point_deep")
    public BigDecimal getResultLineEndPointDeep() {
        return resultLineEndPointDeep;
    }

    public void setResultLineEndPointDeep(BigDecimal resultLineEndPointDeep) {
        this.resultLineEndPointDeep = resultLineEndPointDeep;
    }

    @Basic
    @Column(name = "work_id")
    public Long getWorkId() {
        return workId;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }

    @Basic
    @Column(name = "personnel_id")
    public Long getPersonnelId() {
        return personnelId;
    }

    public void setPersonnelId(Long personnelId) {
        this.personnelId = personnelId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ResultLineEntity that = (ResultLineEntity) o;
        return Objects.equals(resultLineId, that.resultLineId) &&
                Objects.equals(resultLineStartPointId, that.resultLineStartPointId) &&
                Objects.equals(resultLineStartPointName, that.resultLineStartPointName) &&
                Objects.equals(resultLineStartPointDeep, that.resultLineStartPointDeep) &&
                Objects.equals(resultLineEndPointId, that.resultLineEndPointId) &&
                Objects.equals(resultLineEndPointName, that.resultLineEndPointName) &&
                Objects.equals(resultLineEndPointDeep, that.resultLineEndPointDeep) &&
                Objects.equals(workId, that.workId) &&
                Objects.equals(personnelId, that.personnelId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(resultLineId, resultLineStartPointId, resultLineStartPointName,
                resultLineStartPointDeep, resultLineEndPointId, resultLineEndPointName,
                resultLineEndPointDeep, workId, personnelId);
    }

    @ManyToOne
    @JoinColumn(name = "result_line_start_point_id", referencedColumnName = "result_point_id", insertable = false, updatable = false)
    public ResultPointEntity gettResultPointByResultLineStartPointId() {
        return tResultPointByResultLineStartPointId;
    }

    public void settResultPointByResultLineStartPointId(
            ResultPointEntity tResultPointByResultLineStartPointId) {
        this.tResultPointByResultLineStartPointId = tResultPointByResultLineStartPointId;
    }

    @ManyToOne
    @JoinColumn(name = "result_line_end_point_id", referencedColumnName = "result_point_id", insertable = false, updatable = false)
    public ResultPointEntity gettResultPointByResultLineEndPointId() {
        return tResultPointByResultLineEndPointId;
    }

    public void settResultPointByResultLineEndPointId(
            ResultPointEntity tResultPointByResultLineEndPointId) {
        this.tResultPointByResultLineEndPointId = tResultPointByResultLineEndPointId;
    }

    @ManyToOne
    @JoinColumn(name = "work_id", referencedColumnName = "work_id", insertable = false, updatable = false)
    public WorkEntity gettWorkByWorkId() {
        return tWorkByWorkId;
    }

    public void settWorkByWorkId(WorkEntity tWorkByWorkId) {
        this.tWorkByWorkId = tWorkByWorkId;
    }

    @ManyToOne
    @JoinColumn(name = "personnel_id", referencedColumnName = "personnel_id", insertable = false, updatable = false)
    public PersonnelEntity gettPersonnelByPersonnelId() {
        return tPersonnelByPersonnelId;
    }

    public void settPersonnelByPersonnelId(PersonnelEntity tPersonnelByPersonnelId) {
        this.tPersonnelByPersonnelId = tPersonnelByPersonnelId;
    }
}
